var express = require("express");
var jwt = require("jsonwebtoken");
var router = express.Router();
var {
  landlordModel,
  houseModel,
  appointmentModel,
  questionModel,
  answerModel
} = require('../model/model')




router.post("/sdkAddall", async (req, res) => {
  houseModel.create(req.body);
  res.send({
    code: 200,
    msg: "landlordAdd_success",
  });
});


router.post('/sdkAddCell', async (req, res) => {
  houseModel.create(req.body)
  console.log(req.body);
  res.send({
    code: 200,
    msg: 'landlordAdd_success'
  })
})


router.post('/booking_add', async (req, res) => {
  console.log(req.body);
  appointmentModel.create(req.body)
  res.send({
    code: 200,
    msg: 'booking_add_success'
  })
})

router.get("/fangdong", async (req, res) => {
  let { _id } = req.query;
  let fangdong = await landlordModel.findOne({ _id });

  res.send({
    code: 200,
    fangdong,
  });
});



module.exports = router;
